pkill -9 -f "python .*src/train.py"
sleep 2
CLASS="nlp2sql"
TRAIN_BATCH=2
export PYTHONIOENCODING=utf-8
export LANG=zh_CN.UTF-8
LOG_FILE="${CLASS}_train_$(date +%Y%m%d_%H%M%S).log"
CUDA_VISIBLE_DEVICES=0 python src/train.py \
    --stage sft \
    --do_train True \
    --model_name_or_path Qwen/Qwen2.5-7B-Instruct \
    --preprocessing_num_workers 16 \
    --finetuning_type lora \
    --template qwen \
    --flash_attn auto \
    --dataset_dir data \
    --dataset $CLASS \
    --cutoff_len 2048 \
    --learning_rate 5e-05 \
    --num_train_epochs 5 \
    --max_samples 100000 \
    --per_device_train_batch_size $TRAIN_BATCH \
    --gradient_accumulation_steps 1 \
    --lr_scheduler_type cosine \
    --max_grad_norm 1.0 \
    --logging_steps 1 \
    --save_steps 100 \
    --warmup_steps 0 \
    --packing False \
    --enable_thinking False \
    --report_to none \
    --output_dir saves/$CLASS \
    --bf16 True \
    --plot_loss True \
    --trust_remote_code True \
    --ddp_timeout 180000000 \
    --include_num_input_tokens_seen True \
    --optim adamw_torch \
    --lora_rank 8 \
    --lora_alpha 16 \
    --lora_dropout 0 \
    --lora_target all \
    > "$LOG_FILE" 2>&1 &
